#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>

typedef unsigned char N1;
typedef unsigned long int N4;

int main(int argc,char **argv)
{ N1 c1a,c1b,c2a,c2b;
  N1 cc,c0; int ii; N4 n;

#if defined(___OS_WIN)
  setmode(fileno(stdin),O_BINARY);
  setmode(fileno(stdout),O_BINARY);
  setmode(fileno(stderr),O_BINARY);
#endif

  c1a=(N1)'0'; c2a=(N1)'A';
  c1b=c1a+9; c2b=c2a+5;
  c0=0; n=0;

  while (1)
  { ii=fgetc(stdin);
    if (ii==-1) break;
    else cc=(N1)ii;
    if (c1a<=cc && cc<=c1b) cc-=c1a; else
    if (c2a<=cc && cc<=c2b) cc-=c2a-10;
    else { c0=0; continue; }
    c0=(c0<<4)|cc;
    if (++n&1) continue;
    fputc(c0,stdout); c0=0;
  }
  fflush(stdout);

  return (0);
}
